function VarB = VarBetaLinear(d)

       global xbar X sig2 SigmaB1inv SigmaB0inv 
       
 
       X1=X(logical(d),:);
       X0=X(logical(1-d),:);
       VarB =sig2*xbar*((X1'*X1 + sig2*SigmaB1inv) \ xbar' ...
                       +(X0'*X0 + sig2*SigmaB0inv) \ xbar');

            
return
